package org.emmannuel.virtues.client;

import org.emmannuel.virtues.client.panel.AboutVirtuePanel;
import org.emmannuel.virtues.client.panel.MainPanel;
import org.emmannuel.virtues.client.panel.VirtuePanel;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Virtues implements EntryPoint {

	/**
	 * Create a remote service proxy to talk to the server-side Greeting
	 * service.
	 */
	private final RequesterAsync requestsService = GWT.create(Requester.class);
	
	private final AboutVirtuePanel avp = new AboutVirtuePanel(requestsService);

	private final MainPanel mp = new MainPanel(avp);
	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		
		VerticalPanel verPan = new VerticalPanel();
		verPan.setWidth("700px");
		verPan.add(mp);
		verPan.setCellHorizontalAlignment(mp, HasHorizontalAlignment.ALIGN_RIGHT);
		HorizontalPanel vp = new HorizontalPanel();
		vp.add(new VirtuePanel(requestsService, avp));
		vp.add(avp);
		avp.setVisible(false);
		
		verPan.add(vp);
		
		RootPanel.get("divCenter").add(verPan);

		
		
		
	}
}
